/**
 * 2012-2-26
 * @author 李亚松
 * @email  lysong01@gmail.com
 * BasicGenerator.java		automatically create a Generator
 */
package liyasong.util;

public class BasicGenerator<T> implements Generator<T> {
	private Class<T> type;						//这些表达是我没搞懂的？
	public BasicGenerator(Class<T> type) {
		this.type = type;
	}
	/* (non-Javadoc)
	 * @see liyasong.util.Generator#next()
	 */
	@Override
	public T next() {
		try {
			//Assumes type is a public class;
			return type.newInstance();
		} catch (Exception e) {
			throw new RuntimeException(e);		//异常被捕获后，重要是以清晰的名字要抛出
		}
	}

}
